<?php
	include "../../public/commom/config.php";	
	include "../lock2.php";
	include "../../public/commom/commom.php";
?>

<!DOCTYPE html>
<html>
	
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css">
	</head>
	
	<body>
		<div id="main">
			<h1>品牌表</h1>
			<table class="table table-bordered">
				<thead>
					<tr>
						<th>编号</th>
						<th>名称</th>
						<th>图片</th>
						<th>分类</th>
						<th>操作</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<?php
						$sql = "SELECT brand.*, class.name cname FROM brand LEFT JOIN class ON (brand.class_id = class.id)";
					
						$result = mysqli_query($conn, $sql);
						
						while($row = mysqli_fetch_array($result)) {
							echo "<tr>
									<td>" . $row["id"] . "</td>
									<td>" . $row["name"] . "</td>
									<td><img src='" . $imgPathThumb . $row["img"] . "' width='40px'/></td>
									<td>" . $row["cname"] . "</td>
									<td><a href='modify.php?id=" . $row["id"] . "'>修改</a></td>
									<td><a href='delete.php?id=" . $row["id"] . "'>删除</a></td>
								</tr>";
						} 
						
						mysqli_close($conn);
					?>
				</tbody>
				
			</table>
		</div>
	</body>
	
</html>